var signInBtn = document.getElementById("signIn");
var signUpBtn = document.getElementById("signUp");

var container = document.querySelector(".container");

signInBtn.addEventListener("click", function(){
    container.classList.remove("right-panel-active");
});

signUpBtn.addEventListener("click", function(){
    container.classList.add("right-panel-active");
});

<!-- 解决登录页面嵌套问题 -->
if (window != top){
    top.location.href = location.href;
}



var layer;
layui.use(['layer'],function(){
    layer = layui.layer;
});
//触发JS刷新  切换图片
function changeImg(){
    var img = document.getElementById("verify_code_img");
    img.src = "/getImg?date=" + new Date();
}


//判断账号、密码、验证码是否为空、判断验证码是否正确
function check() {
    var form = document.forms[0];

    if (form.name.value == "" || form.pwd.value == "") {
        layer.msg("账号或密码不能为空", {icon:2,time:1500});
        return false;
    }

    if (form.verify_code.value == "") {
        layer.msg("请输入验证码", {icon:2,time:1500});
        return false;
    }

    if(getCode(form)==false){
        return false;
    }

    if(getEnabled(form)==false){
        return false;
    }
    return true;
}

//判断验证码是否正确
function getCode(form){
    var flag = false;
    $.ajax({
        url: "/getCode",
        type: "post",
        dataType: "json",
        async: false,
        data:{"str":form.verify_code.value},
        success: function (data) {
            if(data.data==true){
                flag = true;
            }else{
                flag=false;
                $("#code").val("");
                changeImg();
                layer.msg("验证码输入不正确", {icon:2,time:1500});
            }
        }
    });
    return flag;
}


//判断账号是否启用
function getEnabled(form){
    var flag = false;
    $.ajax({
        url: "/getEnabled",
        type: "post",
        dataType: "json",
        async: false,
        data:{"str":form.name.value},
        success: function (data) {
            if(data.data==null) {
                flag=false;
                changeImg();
                $("#code").val("");
                layer.msg("该账户不存在", {icon:2,time:1500});
            }else if(data.data.enabled==1 && data.data.status==1){
                flag = true;
            }else if(data.data.enabled==2){
                flag=false;
                changeImg();
                $("#code").val("");
                layer.msg("当前账户已停用", {icon:2,time:1500});
            }else if(data.data.status==2){
                flag=false;
                changeImg();
                $("#code").val("");
                layer.msg("当前账户已注销", {icon:2,time:1500});
            }else if(data.data.status==3){
                flag=false;
                changeImg();
                $("#code").val("");
                layer.msg("当前账户已冻结", {icon:2,time:1500});
            }
        }
    });
    return flag;
}

//忘记密码
$("#forgot").on('click',function(){
    location.href="/login/Forget.html";
})